package com.dqy.twserver.server.handle.ehandle.mutil;

import com.dqy.twserver.server.support.Player;
import com.dqy.twserver.server.support.data.RoomInfo;

import java.util.List;

public interface IRoom {

    //生成玩家在房间内状态信息-》name:准备状态:colorId
    default String getRoomInfo(List<Player> playerList){
        StringBuilder sb=new StringBuilder();
        int cid=1;
        for(Player p: playerList){
            sb.append(p.getPlayerName() + ":" +p.getPlayReadi() + ":" + cid);
            cid++;
            sb.append("-");
        }
        String roomListInfoStr = sb.toString();
        return roomListInfoStr;
    }

    default int getBulletId(int rid, RoomInfo info){
        rid<<=24;
        int bulletIdStart = info.getBulletIdStart();
        info.setBulletIdStart(bulletIdStart+1);
        return rid+info.getBulletIdStart();
    }
}
